package vip.aster.common.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 超级管理员
 *
 * @author Aster
 * @since 2023/12/1 11:28
 */
@Getter
@AllArgsConstructor
public enum SuperAdminEnum {
    /**
     * 是
     */
    YES("0", "是"),
    /**
     * 否
     */
    NO("1", "否");

    private final String code;
    private final String text;

    public static String getText(String code) {
        for (SuperAdminEnum s : SuperAdminEnum.values()) {
            if (s.getCode().equals(code)) {
                return s.getText();
            }
        }
        return "";
    }

    public static String getCode(String text) {
        for (SuperAdminEnum s : SuperAdminEnum.values()) {
            if (Objects.equals(s.getText(), text)) {
                return s.getCode();
            }
        }
        return null;
    }
}
